<include file="Public/head" title="首页"/>
<include file="Public/search_head"/>
<div class="main">
	<if condition="$type eq '1'">
        <div class="index_title_warp" id="Bicycle" name="Bicycle">
            <div class="index_title Bicycle"><i class="ico1"></i><span>整车区</span></div>
        </div>
        <ul class="index_slider_warp">
        	<foreach name="list" item="val">
            <li class="index_slider_list clear">
                <a href="{:U('Goods/detail',array('id'=>$val['id']))}">
                    <div class="index_list_left" style="background-image: url({$val.goods_logo})"></div>
                    <div class="index_list_right clear">
                        <div class="index_list_title">{$val.goods_name}</div>
                        <div class="index_list_abstract">{$val.profile}</div>
                        <div class="index_list_money"><i class="iconfont icon-jiage-copy"></i><em class="price-display">{$val.price}</em></div>
                        <div class="index_list_shop">已售<span class="index_list_num price-display">{$val.sale_count|default=0}</span>辆</div>
                    </div>
                </a>
            </li>
            </foreach>
        </ul>
    <else/>
    	<div class="index_title_warp" id="parts" name="parts">
            <div class="index_title parts"><i class="ico2"></i><span>配件区</span></div>
        </div>
        <div id="wrapper">
            <ul class="index_slider_warp">
            	<foreach name="list" item="val">
                <li class="index_slider_list clear">
                    <a href="{:U('Goods/detail',array('id'=>$val['id']))}">
                        <div class="index_list_left" style="background-image: url({$val.goods_logo})"></div>
                        <div class="index_list_right clear">
                            <div class="index_list_title">{$val.goods_name}</div>
                            <div class="index_list_abstract">{$val.profile}</div>
                            <div class="index_list_money"><i class="iconfont icon-jiage-copy"></i><em class="price-display">{$val.price}</em></div>
                            <div class="index_list_shop">已售<span class="index_list_num price-display">{$val.sale_count|default=0}</span>辆</div>
                        </div>
                    </a>
                </li>
                </foreach>
            </ul>
        </div>
    </if>
    <div class="ajaxMore"></div>
</div>
<script type="text/javascript">
    $(function () {
        Price_display("#price-display");
        $(".Second i").click(function () {
            $(".index-option").show();
            $('.index-option').on('touchmove', function (e) { e.preventDefault(); }, false);
        });
        $('.index-option').on('click', function () {
        	 $(".index-option").hide();
         });
        $(".index-option a").click(function () {
            $(".index-option").hide();
        })
    })
</script>
<script>
var page = 1;
var is_end = false;
$(function(){
	var add_more = function(){
		$.post(
			"{:U('')}",
			{page:page,type:'{$type}'},
			function(data){
				if(data.status == '0'){
					is_end = true;
					$('.ajaxMore').html('加载完毕!');
				}else{
					$('.index_slider_warp').append(data);
				}
			}
		)
	}
	//滑动加载
 	$(window).scroll(function(){
 		var wheight = $(this).height();
 		var dheight = $(document).height();
 		var sheight = $(this).scrollTop();
 		if((wheight+sheight)+10>=dheight && !is_end){
 			page++;
 			$('.ajaxMore').html('加载中...');
 			add_more();
 		}
 	});
})

</script>
<include file="Public/foot"/>